using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using T2.WebSecurity.Data.Controllers.Interfaces;
using T2.WebSecurity.Data.Entities.Interfaces;
using T2.WebSecurity.Business.Entities.Interfaces;
using T2.WebSecurity.Business.Entities;
using T2.WebSecurity.Business.Builders;
using T2.WebSecurity.Business.Directors.Interface;
using T2.WebSecurity.Business.Entities.Search.Interfaces;

//--Change Management Control - OAuthMembership Director  --**********************
//--Created By: trooks
//--Description: OAuthMembership Director Class
//--Created Date: 03/07/2013 10:48:42
//--*************************************************************

namespace T2.WebSecurity.Business.Directors
{
	public partial class OAuthMembership_Director_biz : IOAuthMembership_director_biz
	{
		
		public List<IOAuthMembership_biz> Construct (IOAuthMembership_biz _param, bool BuildUp, bool BuildDown)
		{
			OAuthMembership_Builder build = new OAuthMembership_Builder();
			List<IOAuthMembership_biz> retVal = build.BuildParts(_param);
			foreach(IOAuthMembership_biz item in retVal)
			{
				item.UserProfile = BuildUserProfile(item, BuildUp, false);
		}
			return retVal;
		}
		public List<IOAuthMembership_biz> Construct (IOAuthMembershipSearch_biz _param, bool BuildUp, bool BuildDown)
		{
			OAuthMembership_Builder build = new OAuthMembership_Builder();
			List<IOAuthMembership_biz> retVal = build.BuildParts(_param);
			foreach(IOAuthMembership_biz item in retVal)
			{
				item.UserProfile = BuildUserProfile(item, BuildUp, false);
		}
			return retVal;
		}
		private IUserProfile_biz BuildUserProfile(IOAuthMembership_biz _param, bool BuildUp, bool BuildDown)
		{
			IUserProfile_biz retVal = new UserProfile_biz();
			if(BuildUp)
			{
			IUserProfile_biz UserProfileParam = new UserProfile_biz();
			UserProfileParam.Action = "GetOne";
			UserProfileParam.UserId = _param.UserId;
			UserProfile_Builder builder = new UserProfile_Builder();
			retVal = builder.BuildParts(UserProfileParam).First();
			}
			return retVal;
		}
	}
}